package com.cwiyc.orderonlineback.controller;

import com.cwiyc.orderonlineback.common.Result;
import com.cwiyc.orderonlineback.entity.Shop;
import com.cwiyc.orderonlineback.mapper.ShopMapper;
import com.cwiyc.orderonlineback.service.ShopServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping
public class ShopController {

    @Resource
    ShopMapper shopMapper;

    @Autowired
    ShopServiceImpl shopService;

    @PostMapping("/getshop")
    public Result<?> getShop(@RequestBody Shop shop) {
        return shopService.getShop(shop);
    }

    @GetMapping("/getallshop")
    public Result<?> getAllShop(){return shopService.getAllShop();}

    @PostMapping("/updatespic")
    public Result<?> updateSpic(@RequestBody Shop shop) {
        return shopService.updateSpic(shop);
    }

    @PostMapping("/updatesinfo")
    public Result<?> updateSinfo(@RequestBody Shop shop) {
        return shopService.updateSinfo(shop);
    }

    @PostMapping("/getcodebyuid")
    public Result<?> getCodebyuid(@RequestBody Shop shop) {
        return shopService.getCodebyuid(shop);
    }

    @PostMapping("/getsidbyuid")
    public Result<?> getSidbyuid(@RequestBody Integer uid) {
        return shopService.getSidbyuid(uid);
    }

    @PostMapping("/applyshop")
    public Result<?> applyShop(@RequestBody Shop shop) {
        return shopService.applyShop(shop);
    }

}
